#!/bin/sh
#SBATCH -J subjobs # jobname
#SBATCH -p general # Partition to submit to (queue)
#SBATCH -N 1 # number of nodes, Ensure that all cores are on one machine
#SBATCH -n 1 # number of cores
#SBATCH --mem 10 # memory pool for all cores
#SBATCH -t 0-00:10 # time (D-HH:MM)
#SBATCH -o  .%N.%j.out # output file, %N name of nodelist, %j jobID

script_dir=/pine/scr/m/e/meichen/hovestdta/scripts
cd ${script_dir}

for cc in {1..2}; do
	for aa in 200; do
		for bb in DI20; do
					sed "s|nsample|${aa}|g; s|simnum|${cc}|g; s|scenario|${bb}|g"  ${script_dir}/D0002_simulation.R > sim/d0002/d0002_${aa}_${cc}_${bb}.R;
					sbatch -o log/iter/d0002_${aa}_${cc}_${bb}.log -n 1 \
						--mem=3000 -t 5:40:00 --job-name="d_${aa}_${cc}_${bb}" \
						/nas/longleaf/apps/r/3.6.0/bin/R --vanilla --no-restore --no-save CMD BATCH \
        					sim/d0002/d0002_${aa}_${cc}_${bb}.R sim/d0002/d0002_${aa}_${cc}_${bb}.Rout;
		done
	done
done
